package com.example.springbootsfzy.service.lishenao;

import com.example.springbootsfzy.domain.Members;
import com.example.springbootsfzy.mapper.MembersMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

//会员信息表
@Service
public class MembersService {
    @Autowired
    private MembersMapper membersMapper;
    //删除方法
    public int deleteByPrimaryKey(Long id) {
        return membersMapper.deleteByPrimaryKey(id);
    }

    //增加方法
    public int insert(Members record) {
        return membersMapper.insert(record);
    }

    //查询方法根据id
    public Members selectByPrimaryKey(Long id) {
        return membersMapper.selectByPrimaryKey(id);
    }

    //修改方法
    public int updateByPrimaryKey(Members record) {
        return membersMapper.updateByPrimaryKeySelective(record);
    }

   //查询所有会员信息
    public List<Members> selectAll() {
        return membersMapper.selectAll();
    }


    //用会员名反查会员id
    public Members selectByUsername(String username) {
        return membersMapper.selectByUsername(username);
    }
}
